package tech.dx.springdb.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.dx.springdb.entity.CourseAdvice;
import tech.dx.springdb.respository.CourseAdviceRepository;
import tech.dx.springdb.service.CourseAdviceService;

/**
 * @ClassName CourseAdviceServiceImpl
 * @Description TODO
 * @Author daoxuan
 * @Date 2019/4/1 12:20
 * @Version 1.0
 */
@Service
public class CourseAdviceServiceImpl implements CourseAdviceService {
    @Autowired
    private CourseAdviceRepository courseAdviceRepository;
    @Override
    public CourseAdvice add(CourseAdvice courseAdvice) {
        return  courseAdviceRepository.save(courseAdvice);
    }

    @Override
    public CourseAdvice update(CourseAdvice courseAdvice) {
        return courseAdviceRepository.save(courseAdvice);
    }

    @Override
    public CourseAdvice getById(long id) {
        return courseAdviceRepository.findById(id).get();
    }
}
